public class demo16 {
    public static void main(String[] args) {
        Object object = new Object();

        Thread t1 = new Thread(() -> {
            System.out.println("wait");
            synchronized (object){
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("wait");
        });

        Thread t2 = new Thread(() -> {
            System.out.println("notify");
            synchronized (object){
               object.notify();
            }
            System.out.println("notify");
        });

        t1.start();
        t2.start();
    }
}
